|
|
|
|
|
|
|
Pattern investigation does not have to be in code. The construction process itself can have repeatable patterns. Visual Basic enables you to benefit from such process patterns through the VBProject object, Visual Basic add-ins, and, generally speaking, the Extensibility Object Model. |
|
|
|
|
|
|
|
|
Note Read about the Extensibility Object Model in my book Visual Basic 5 Development (Sams Publishing, 1998). |
|
|
|
|
|
|
|
|
|
The Difference Between Interface and Implementation Classes |
|
|
|
|
|
|
|
|
In Visual Basic, any class that implements its own interface or the interface of another class is an implementation class. However, an interface class is a class whose sole responsibility is to enable its interface to be implemented by other classes. Borrowing from the Samsona Bank Teller System example, the CheckingAccount class is an interface class because its methods have to be implemented by (performed by) the BasicPersonalCheckingAccount class. |
|
|
|
|
|
|
|
|
The distinction between interface and implementation classes is very important in component development. As part of Microsoft's overall design strategy, COM components implement at least one interface. This is not an option. Gradually, an interface can evolve, but the previous interface must still be supported, for the benefit of clients having no knowledge of the new interface. |
|
|
|
|
|
|
|
|
Illustrating Example: Second Bank of Carrollton |
|
|
|
|
|
|
|
|
For your Second Bank of Carrollton customer, for instance, say you created an interface class, ISavingsAccount, with the following public methods: |
|
|
|
 |
|
|
|
|
deposit()
withdraw()
calculateInterest() |
|
|
|
|
|
|
|
|
Now your customer informs you that for new savings accounts, no withdrawals are allowed, only transfers to a checking account. On the surface, the answer seems simple: Eliminate the withdraw methodwhich you do that night. The next day you receive a call from some tellers who can't execute any savings withdrawal transactions for older savings account products. You have to go back and add that interface method, at a cost to both the Second Bank of Carrollton and your employer, Samsona Software. |
|
|
|
|
|